import request from '@u/request'
// 获取商品列表
interface CateTypes {
  page?: number,
  pageSize?: number,
  key?: string,
  start?: string,
  end?: string
}
const fetchCates = (params:CateTypes = {}) => (
  request.get('/cateLists', {params})
)

const addCates = (params = {}) => {
  return  request.post('/addCate', params)
}
// 获取分类详情
const fetchCateDetail = (id: number) =>  (
  request.get('/cateDetail', {params: {id}})
)
// 修改商品分类
const updateCate = (params = {}) => {
  return  request.put('/updateCate', params)
}
// 删除分类
const delCate =  (id: number) =>  (
  request.delete('/delCate', {params: {id}})
)
export {
  fetchCates,
  addCates,
  fetchCateDetail,
  updateCate,
  delCate
}